Imports System
Imports ValidationFramework


Public Class RequiredShortRuleAttributeExample
    ' Methods
    Public Sub DoSomething( _
    <RequiredShortRule()> ByVal paramData As Short)
        ParameterValidationManager.ThrowException(Me, doSomethingHandle, paramData)
    End Sub


    ' Properties
    <RequiredShortRule()> _
    <RequiredShortRule(InitialValue:=2, _
    ErrorMessage:="2 is an invalid value.")> _
    Public Property Data() As Short
        Get
            Return _data
        End Get
        Set(ByVal value As Short)
            _data = value
        End Set
    End Property


    ' Fields
    Private _data As Short
    Private Shared ReadOnly doSomethingHandle As RuntimeMethodHandle = _
    GetType(RequiredShortRuleAttributeExample).GetMethod("DoSomething").MethodHandle
End Class

